# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=yasca
pkgver=2.1
pkgrel=1
groups=('blackarch' 'blackarch-code-audit')
pkgdesc='Multi-Language Static Analysis Toolset.'
arch=('any')
url='https://sourceforge.net/projects/yasca/files/Yasca%202.x/'
license=('BSD')
depends=('php' 'java-environment')
source=("http://downloads.sourceforge.net/project/$pkgname/Yasca%202.x/Yasca%202.1/$pkgname-$pkgver.zip")
sha512sums=('31c7a8572d861a221b1585cb18ba6078b94f0495c2dc9873e103aa5d7e7838198d4bd36f631ae351a81b88c13d27eeec6ff78262e63b0f4353612d20411e6144')

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/" doc/LICENSE \
    doc/3rdparty/licenses/*

  rm -r doc/{LICENSE,3rdparty}

  install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname/" doc/*

  rm -rf doc yasca-2.1.zip

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec php -c ./resources/php_linux.ini -q yasca.php ${@}
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

